from django.db import models

# Create your models here.
from django.db import models
from User.models import MyUser
from Shop.models import Commodity
from simplepro.components import fields
class Store(models.Model):
    # 店铺id，Django会自动创建一个id字段作为主键，所以这里不需要再显式声明
    # 店铺名（char）:
    name = models.CharField(max_length=100, verbose_name='店铺名')

    # 店铺描述(char)
    description = models.TextField(verbose_name='店铺描述')

    # 所属卖家(foreignKey)
    user = models.ForeignKey('User.MyUser', on_delete=models.CASCADE, verbose_name='卖家')
    address = fields.AMapField(max_length=128, verbose_name='地址', null=True, blank=True, help_text='点击地图获取地址',
                               pick_type='address')
    score = fields.RateField(verbose_name='店铺评分', max_value=5, default=4, disabled=True)
    status = models.CharField(max_length=10, verbose_name='营业状态', default='申请')


    class Meta:
        verbose_name = '店铺'
        verbose_name_plural = '店铺'
    def __str__(self):
        return self.name






